
package RMI;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;

public class Connect {
    public Connection con;
    public Statement st;  
    String s[] = new String[4];
    public Connect(String[] chuoi)
    {
//        this.s = chuoi;
         try {
           String driver = "com.mysql.jdbc.Driver";
            //String url = chuoi[0];
            String username = "root";
            String password = "admin";
            String url = "jdbc:mysql://127.0.0.1:3306/laptop";
            Class.forName(driver).newInstance();
            con = DriverManager.getConnection(url, username, password);
            
            st = con. createStatement();
             System.out.println("OK");
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, "Khong ket noi duoc");
           
        }
    }
}
